package com.java.shop.controller;

import com.java.shop.bean.User;
import com.java.shop.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
@ResponseBody
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/regist")
    public String userRegist(User user){
        System.out.println("11111");
        System.out.println("22222");
        System.out.println("33333");

        return  "";
    }

    @GetMapping("/getUser")
    public String getUser(int id){
        System.out.println("用户ID："+id);
        User user = userService.selectByPrimaryKey(id);
        String result = user.toString();
        System.out.println("用户信息："+result);
        return result;
    }
}
